package com.idea.zd.sys.quartz;

import com.jfinal.kit.HttpKit;

import java.util.logging.Logger;

import static java.util.logging.Logger.getLogger;

public class IqiyiJob implements Runnable {
    private static final Logger log = getLogger(String.valueOf(IqiyiJobMonth.class));
    private int length;
    private int start;

    public IqiyiJob(int length,int start){
        this.length = length;
        this.start = start;
    }

    @Override
    public void run() {
       //System.out.println("开始");
       //System.out.println("线程名"+Thread.currentThread().getName());
       int start2 = start;
        for(int i =start2 ;i <= length;i++ ){
            Long startTime = System.currentTimeMillis();
            try{
                log.info("月时开始："+i);
                HttpKit.get("http://app.fansiji.com/h5/iqiyi/Home/Api/ApiNum/getMonthVideoUrl?page="+i+"");
                //System.out.println("===========================");
               // System.out.println("成功月时"+i);
                //System.out.println("===========================");
                //System.out.println("月时线程名"+Thread.currentThread().getName());
                //System.out.println("===========================");
            }catch (Exception e){
                e.printStackTrace();
                continue;
            }finally{
                log.info("月时结束："+i);
                //System.out.println("月时用时："+(System.currentTimeMillis()-startTime)/1000);
            }
        }
    }
}
